package com.effectivsocial.domain;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import org.hibernate.envers.Audited;
import org.hibernate.envers.NotAudited;


@Entity
@Table(name = "t_link_group")
@Audited
@ToString
public class LinkGroup implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Id
	@Getter @Setter
	@Column(name="name")
	private String name;
	
	@Getter @Setter
	@Column(name = "label_key")
	private String labelKey;
	
	
	@Getter @Setter
	@Column(name = "position")
	private String position;
	
	@Getter @Setter
	@Column(name = "href")
	private String href;
	
	
	@NotAudited
	@Getter @Setter
    @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
    @JoinTable(name = "t_link_group_link", joinColumns = { @JoinColumn(name = "link_group_id") }, inverseJoinColumns = { @JoinColumn(name = "link_id") })
    private List<Link> links;
	
	@NotAudited
	@Getter @Setter
	@ManyToMany(mappedBy="linkGroups")
	private List<ViewDefinition> viewDefinitions;
	
	
}
